public class BubbleSorter implements ISortable {

	@Override
	public int[] Sort(int[] unsorted) {
		int[] result = unsorted.clone();
		
		for (int i = 0; i < result.length - 1; i++) {
			for (int j = 0; j < result.length - (i + 1); j++) {
				if(result[j] > result[j+1])
				{
					int temp	= result[j];
					result[j]	= result[j+1];
					result[j+1]	= temp;
				}
			}
		}
		
		// Print for debug purpose
//		System.out.print("Sorted: ");
//		for (int i = 0; i < result.length; i++) {
//			System.out.format("%3d ", result[i]);
//		}
//		System.out.println("");
		
		return result;
	}

}
